package com.yang.controller;

import com.yang.mapper.MenuMapper;
import com.yang.pojo.Menu;
import com.yang.util.JsonResult;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author 杨天可
 * @Date 2021/3/10 17:42
 * @Version 1.0
 */
@Transactional
@RestController
@RequestMapping("/menu")
public class MenuController {

    @Resource
    MenuMapper menuMapper;

    /***
     * 获取菜单列表
     * @return
     */
    @GetMapping("/menuList")
    public Map<String,Object> menuList(){
        JsonResult jsonResult = new JsonResult();
        List<Menu> menus = menuMapper.selectAll();
        jsonResult.setCode("200");
        jsonResult.setData(menus);
        return jsonResult.getValues();
    }


}
